package com.jn.dagger.views;

import android.util.Log;

import com.jn.dagger.R;
import com.jn.dagger.application.MyApplication;
import com.jn.dagger.base.BaseActivity;
import com.jn.dagger.component.DaggerAllComponent;
import com.jn.dagger.database.DBHelper;
import com.jn.dagger.entity.Student;
import com.jn.dagger.module.DBModule;
import com.jn.dagger.module.StudentModule;

import java.util.List;

import jakarta.inject.Inject;

public class InfoActivity extends BaseActivity {
    @Inject
    public Student mStudent;
    @Inject
    public DBHelper mDBHelper;
    @Override
    public int getLayoutId() {
        return R.layout.activity_info;
    }

    @Override
    public void init() {
        /*DaggerAllComponent
                .builder()
                .studentModule(new StudentModule())
                .dBModule(new DBModule(this))
                .build()
                .injectInfoActivity(this);*/
        ((MyApplication)getApplication()).getAllComponent().injectInfoActivity(this);
        Log.d("asdf", "Info mStudent === " + mStudent.hashCode());
        List<Student> list = mDBHelper.selectAllStudent();
        int size = list.size();
        Log.d("asdf", "Info mDBHelper === " + mDBHelper.hashCode());
        mStudent = mDBHelper.selectAllStudent().get(size - 1);
        //Log.d("asdf", "Info mStudent === " + mStudent.hashCode());
        Log.d("asdf", mStudent.toString());
    }
}
